package com.seed.vo;


import com.seed.constants.CommonResultStatusEnum;
import lombok.Data;

@Data
public class Result<T> {


	public static <T> Result<T> success(T data) {
		return new Result<T>(CommonResultStatusEnum.SUCCESS.getStatus(), null, data);
	}

	public static Result fail(Integer status, String error) {
		return new Result(status, error, null);
	}


	private Integer status;
	private String error;
	private T data;

	public Result() {

	}

	public Result(Integer status, String error, T data) {
		this.status = status;
		this.error = error;
		this.data = data;
	}


	public boolean isSuccess() {
		return CommonResultStatusEnum.SUCCESS.getStatus().equals(status);
	}

}
